
namespace = ebike_registry
project = $(app)
version = latest
server = registry.cn-hangzhou.aliyuncs.com
hub_user = 深圳市豆点云科技术有限公司
hub_pwd = dev%ddyk@219_i

help:
	@echo "usage: make <option> app=<app>"
	@echo "option and effects:"
	@echo "    build   : build files into executable file on Linux"
	@echo "    buildimg: build docker image"
	@echo "    pushimg : push built docker image to hub registry"
	@echo "app         : options: aggregation/auth/manager/shadow/signal/statistic"

build:
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64  go build -o ./bin/${project} ${project}/

buildimg:
	docker build -t ${namespace}/${project}:${version} --platform linux/amd64 --build-arg APP=${project} .

pushimg:
	docker login -u ${hub_user} -p ${hub_pwd} ${server}
	docker tag ${namespace}/${project}:${version} ${server}/${namespace}/${project}:${version}
	docker push ${server}/${namespace}/${project}:${version}
